package com.lt.basic.project.pojo.validate.mino.user;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lt.basic.project.common.util.StringUtils;
import com.lt.basic.project.pojo.entity.mino.user.UserAuth;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户授权表(basic_user_auth)搜素对象
 * @author ：LT
 * @Created in : 2023-11-27
 */
@Data
@ApiModel(value="UserAuth搜素对象", description = "用户授权表搜素对象")
public class UserAuthSearchValidate implements Serializable {

    private static final long serialVersionUID=1L;



    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    /**
     * Openid
     */
    @ApiModelProperty(value = "Openid")
    private String openid;

    /**
     * Unionid
     */
    @ApiModelProperty(value = "Unionid")
    private String unionid;

    /**
     * 客户端类型: [1=微信小程序, 2=微信公众号, 3=手机H5, 4=电脑PC, 5=苹果APP, 6=安卓APP]
     */
    @ApiModelProperty(value = "客户端类型: [1=微信小程序, 2=微信公众号, 3=手机H5, 4=电脑PC, 5=苹果APP, 6=安卓APP]")
    private Integer terminal;

    /**
     * 创建时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;



    /**
    * 查询数据过滤
    */
    public void query(UserAuthSearchValidate searchValidate, LambdaQueryWrapper<UserAuth> lqw) {
        if (StringUtils.isNotObj(searchValidate.getUserId())) {
            lqw.eq(UserAuth::getUserId, searchValidate.getUserId());
        }
        if (StringUtils.isNotObj(searchValidate.getOpenid())) {
            lqw.eq(UserAuth::getOpenid, searchValidate.getOpenid());
        }
        if (StringUtils.isNotObj(searchValidate.getUnionid())) {
            lqw.eq(UserAuth::getUnionid, searchValidate.getUnionid());
        }
        if (StringUtils.isNotObj(searchValidate.getTerminal())) {
            lqw.eq(UserAuth::getTerminal, searchValidate.getTerminal());
        }
        if (StringUtils.isNotObj(searchValidate.getCreateTime())) {
            lqw.eq(UserAuth::getCreateTime, searchValidate.getCreateTime());
        }
        if (StringUtils.isNotObj(searchValidate.getUpdateTime())) {
            lqw.eq(UserAuth::getUpdateTime, searchValidate.getUpdateTime());
        }
    }

}